package zut.cs.liziflower.service.impl;

import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import zut.cs.liziflower.entity.Flower;
import zut.cs.liziflower.entity.Language;
import zut.cs.liziflower.mapper.FlowerMapper;
import zut.cs.liziflower.service.IFlowerService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author xuwenke
 * @since 2022-05-16
 */
@Service
@Transactional
public class FlowerServiceImpl extends ServiceImpl<FlowerMapper, Flower> implements IFlowerService {

    @Resource
    private FlowerMapper flowerMapper;


    @Override
    public List<Flower> getFlowers(String name) {
        return flowerMapper.getFlowers(name);
    }

    @Override
    public Flower getDetail(int flowerid) {
        return flowerMapper.getDetail(flowerid);
    }

    @Override
    public List<Flower> getAllFlower() {
        List<Flower> list = flowerMapper.getAll();
//        return flowerMapper.selectList(null);
        return list;
    }

    @Override
    public List<Language> getFlowerLanguage() {
        List<Language> list = flowerMapper.getFlowerLanguage();
        return list;
    }

    @Override
    public List<Language> getOneLanguage(String find) {
        String string = '%'+find+'%';
        return flowerMapper.getOneLanguage(string);
    }

//    @Override
//    public List<Flower> getFlowers(String name) {//根据分类名称获取鲜花
//        List<Flower> list = flowerMapper.getFlowers(name);
//        return list;
//    }
}
